package com.city.repository.city;

import com.city.domain.city.CityTown;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @deprecation: 乡镇基本信息表
 * @dmail: 398521613@qq.com
 * @author: L-H
 * @date: 2018-07-18 13:14
 */
@Repository
public interface CityTownRepository extends JpaRepository<CityTown,Integer> {
    @Query(value = "select * from city_town", nativeQuery=true)
    List<CityTown> findName(String code);

    @Query(value = "select * from city_town", nativeQuery=true)
    List<CityTown> findName();

    /**
     * @Author: 李顺时
     * @Description: 获取对应乡镇的名称
     * @param: id 乡镇的id
     * @Date: 16:39 2018/8/12
     */
    @Query(value = "select town_name from city_town where town_id = ?1", nativeQuery=true)
    String findTownNameById(Integer id);


}
